package org.tacticalTroopers.jme.server.object;

import java.util.HashMap;
import java.util.Map;

import org.tacticalTroopers.jme.common.message.GameState;
import org.tacticalTroopers.jme.common.message.Id;

import com.jme3.network.message.Message;

public class ServerGameState {
	
	GameState gameState = new GameState();

	Map<Integer, ServerElement> dynamicElements;

	public ServerGameState() {
		dynamicElements = new HashMap<Integer, ServerElement>();
	}

	/*
	public ServerGameState setGameArea(ServerGameArea gameArea) {
		dynamicElements = gameArea.getGameState().getDynamicElements();
		return this;
	}
	 */

	public Map<Integer, ServerElement> getDynamicElements() {
		return dynamicElements;
	}


	public GameState getGameStateMessage() {
		return gameState;
	}


	public void addElement(Id id, ServerElement elem) {
		dynamicElements.put(id.getValue(),elem);
		gameState.addElement(id.getValue(),elem.getElementMessage());
	}


	public void removeElement(Id id) {
		dynamicElements.remove(id.getValue());
		gameState.removeElement(id.getValue());
	}

}
